package com.rainszj.service.impl;

import com.rainszj.mapper.TypeMapper;
import com.rainszj.pojo.po.Type;
import com.rainszj.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author rainszj
 * 2020/3/12
 */
@Service
public class TypeServiceImpl implements TypeService {

    @Autowired
    TypeMapper typeMapper;

    @Override
    public int saveType(Type type) {
        return typeMapper.saveType(type);
    }

    @Override
    public int removeType(Long id) {

        return typeMapper.removeType(id);
    }

    @Override
    public int updateType(Long id, Type type) {

        return typeMapper.updateType(id, type);
    }

    @Override
    public Type queryTypeById(Long id) {

        return typeMapper.queryTypeById(id);
    }

    @Override
    public Type queryTypeByName(String name) {

        return typeMapper.queryTypeByName(name);
    }


    @Override
    public List<Type> listAllType() {

        return typeMapper.listAllType();
    }

    /**
     * 查询给当前博客设置的所有的分类，
     * 当前分类存在，但没有给博客设置的分类不被查询
     *
     * @return
     */
    @Override
    public List<Type> listAdminType() {
        return typeMapper.listAdminType();
    }
}
